package com.mdd.front.service.impl.yangyangLeadingEnterprise;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mdd.common.entity.yangyangLeadingEnterprise.TAppOrderItem;
import com.mdd.common.mapper.yangyangLeadingEnterprise.TAppOrderItemMapper;
import com.mdd.front.service.yangyangLeadingEnterprise.ITAppOrderItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * 【请填写功能名称】实现类
 * @author LikeAdmin
 */
@Service
public class TAppOrderItemServiceImpl implements ITAppOrderItemService {
        
    @Resource
    TAppOrderItemMapper appOrderItemMapper;

    @Override
    public void insert(TAppOrderItem item) {
        appOrderItemMapper.insert(item);
    }

    @Override
    public List<TAppOrderItem> selectOrderItemListByOrderId(Integer orderId) {
        QueryWrapper<TAppOrderItem> wrapper = new QueryWrapper<>();
        wrapper.eq("order_id", orderId);
        List<TAppOrderItem> itemList = appOrderItemMapper.selectList(wrapper);
        return Optional.ofNullable(itemList).orElse(new ArrayList<>());
    }
}
